package org.example.sence;

import com.almasb.fxgl.dsl.FXGL;
import com.almasb.fxgl.scene.SubScene;
import com.almasb.fxgl.time.LocalTimer;
import javafx.scene.control.Button;
import javafx.scene.image.ImageView;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.util.Duration;

public class EndSence extends SubScene {

    private LocalTimer timer;

    public EndSence() {
        StackPane root = new StackPane();
        root.setPrefSize(FXGL.getAppWidth(), FXGL.getAppHeight());
        root.setStyle("-fx-background-color: rgba(0,0,0,0.7);");

        // 商店内容
        VBox shopUI = new VBox(10);

        ImageView view = new ImageView(FXGL.image("end.png"));
        view.setFitHeight(FXGL.getAppHeight());
        view.setFitWidth(FXGL.getAppWidth());
        shopUI.getChildren().add(view);

        root.getChildren().add(shopUI);
        getContentRoot().getChildren().add(root);

        timer = FXGL.newLocalTimer();


//
        if (timer.elapsed(Duration.seconds(2))) {
            System.out.println("结束了");
        }

    }

    private Button createExitButton() {
        Button btn = new Button("返回游戏");
        btn.setOnAction(e -> FXGL.getSceneService().popSubScene());
        return btn;
    }

}
